package server.utils;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;

import server.business.entity.User;

import com.core.coder.StringUtil;


public class MockUtil {
    
    public static List<User> randomUserList(int count) {
        Random r = new Random();
        List<User> list = new ArrayList<User>();
        for (int i = 0; i < count; i++) {
            User u = new User();
            u.setName(StringUtil.randomString(3 + r.nextInt(5)));
            u.setPassword(StringUtil.randomString(10));
            u.setEmail(StringUtil.randomString(3 + r.nextInt(5)) + "@126.com");
            u.setNickName(StringUtil.randomString(3 + r.nextInt(5), "l"));
            
            u.setRobot(r.nextBoolean());
            u.setDiffLevel(u.isRobot() ? 1 + r.nextInt(10) : 0);
            
            u.setFreeze(r.nextBoolean());
            u.setShutup(r.nextBoolean());
            
            u.setOnline(r.nextBoolean());
            
            u.setTitle(StringUtil.randomString(6, "l"));
            u.setScore(r.nextInt());
            u.setLevel(r.nextInt(100));
            u.setVipLevel(r.nextInt(3));
            u.setVipDate(u.getVipLevel()==0 ? null : new Date());
            
            u.setWinCount(r.nextInt(1000000));
            u.setLoseCount(r.nextInt(1000000));
            u.setAchieveValue(r.nextInt(30));
            
            Map<String, Long> wallet = new HashMap<String, Long>();
            wallet.put("土豪币", r.nextLong());
            wallet.put("比特币", r.nextLong());
            
            u.setWallet(wallet);
            list.add(u);
        }
        return list;
    }

}
